$(function () {
  $('#submit').click(() => {
    let userInfo = $('#login').serializeArray();
    userInfo = unSerializeArray(userInfo);
    $.ajax({
      type: 'post',
      url: '/login',
      data: {
        username: userInfo.username,
        password: userInfo.password
      }
    }).then(res => {
      if (res.msg == '登录成功') {
        alert('登录成功！');       
      } else {
        alert('您输入的帐号或密码不正确，请重新输入！');
      }
    })
  })
})